Prevent resource sampling crash on profiles with missing/gap dynamics#1943
Open
AaronPlave wants to merge 1 commit into
Open
Prevent resource sampling crash on profiles with missing/gap dynamics#1943AaronPlave wants to merge 1 commit into
AaronPlave wants to merge 1 commit into
Conversation
…amics Real profile segments with null/missing dynamics are now emitted as gaps, and segments with malformed dynamics (missing initial/rate) are skipped, instead of throwing during resource profiling. Adds an isRealDynamics type guard and tightens ProfileSegment dynamics typing. Covered by unit tests in resources.test.ts; the external-dataset.json fixture gains a dynamics-less segment that reproduces the original crash.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Fixes a crash in resource sampling where real profiles with null/missing dynamics (or dynamics lacking initial/rate) made sampleProfiles throw, breaking views with these resources. Split out of #1837. Profile segments with no dynamics are valid profiles in PlanDev (comment from DB column says dynamics "may be NULL if no behavior is known" and that a trailing NULL segment is required to mark a profile's end so effectively every profile ends in a gap segment. A real world example of this is an external dataset with gaps like contact windows.
Details
Visible UX changes
Plans whose external profiles contain gap/dynamics-less segments now render (gaps shown) instead of crashing.
Verification
New unit tests added to
src/utilities/resources.test.tsto cover these cases.